home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / SML40 / !Sml / Sml / compstuff / Makefile < prev    next >
Makefile  |  1990-12-05  |  6KB  |  172 lines

  1. # $Header: /a/coll/disk/home/coll/rjg/Ml/fam.src/UPTODATE/RCS/Makefile,v 4.4 90/07/04 11:09:33 rjg Exp $
  2. # $Log: Makefile,v $
  3. # Revision 4.4  90/07/04  11:09:33  rjg
  4. # Readline version 4.1.00
  5. # New bytecode OpPrompt 
  6. # Revision 4.0  89/09/20  13:28:00  rjg
  7. # incorporated RCS
  8. # Revision 4.0  89/09/20  13:12:53  rjg
  9. # incorporated RCS
  10. # Modified by as@uk.ac.ed.aipna for GNU make on Acorn Archimedes
  11. # machines: suffixes become prefixes, manually patch round use of
  12. # sed,... 
  13. #
  14. #       Add a new type of suffix so that we can build object code from
  15. #       headers directly and avoid the pain of keeping two different
  16. #       files in synchronization.
  17. #
  18. # NICK: The magic suffix is now ".END", which is more obvious than ".tp".
  19. #       All the temporary files created during a make have names beginning
  20. #       with "_", which is more obvious than nothing at all.
  21. #
  22.  
  23. .PREFIXES: c. h. o.
  24.  
  25. #
  26. #       Here is where we set all of the flags to the $(CC) compiler to
  27. #       control the defaults for compilation.  Note that this is
  28. #       useful as we run recursive makes (c.f. debug and profile).
  29. #
  30. #       The GNU Readline library (distributed with bash) may be used to 
  31. #       allow line editing.  If you have this software available, 
  32. #       add -DREADLINE to CFLAGS and add the appropriate pathnames to 
  33. #       CFLAGS and LIBFLAGS (and LDFLAGS)
  34. #       See the man pag for details on features available with Readline lib.
  35. #
  36.  
  37. LIBFLAGS = 
  38. LDFLAGS = 
  39. CFLAGS = -pcc -DRISC_OS -DARM
  40. EQ = "="
  41. #       NICK: never use an optimiser, if you expect your code to work
  42. #       afterwards.
  43. #
  44. #       Making this a parameter allows the test target to be invoked
  45. #       for different versions of the program.
  46. #
  47. VERSION = fam
  48. #
  49. #       Specify optional parameters for the ML interpreter itself.
  50. #
  51. MLPARMS = -h 2000 ml.new
  52. #
  53. #       Here is the rule for how to build an object module which holds
  54. #       the storage allocation for all the external variables in a
  55. #       header file.  The caveat with this particular rule is that you
  56. #       should never have a header file and a C source file with the
  57. #       same name.
  58. #
  59. #       Note that this allows the user to create header files which
  60. #       contain all of the external declarations for external typing
  61. #       and will allow external storage allocation to be done
  62. #       automatically.  The form of the header files is as follows:
  63. #
  64. #       extern int      var /*/ = 0 /*/ ;
  65. #
  66. #       Note the very special form of comment markers, i.e. /*/, which
  67. #       allows a distinctive form for removal.
  68. #
  69.  
  70.  
  71. o.%: c.%
  72.         $(CC) $(CFLAGS) -c $<
  73.  
  74.  
  75. o.%: h.%
  76.         sed -e "s?extern?/* ext */?" -e "s?\/\*\/?/* */?g" < $< > c.$(basename $<) 
  77.         $(CC) -c $(CFLAGS) c.$(basename $<) 
  78.         delete c.$(basename $<)
  79.  
  80. #
  81. #       Define the list of all the primary targets which this makefile
  82. #       creates.  This is most useful when it is used by clobber.
  83. #
  84. ALL = debug profile fam 
  85. OTHER = c._dumpcode c._debug c._version
  86.  
  87. all:    $(ALL)
  88.  
  89. #
  90. #       Clean all extraneous files from this directory.
  91. #
  92. clean:
  93.         delete -f o.*
  94. #
  95. #       Clean all generated files from this directory.
  96. #
  97. clobber:        clean
  98.         delete -f $(ALL) $(OTHER)
  99. #
  100. #       How to retrieve the function which is used to call the
  101. #       makefile with a test target.  This file will specify which
  102. #       version of the interpreter to run and what parameters to
  103. #       provide it with.
  104. #
  105. #       List all of the object modules needed to build the ML
  106. #       interpreter.
  107. #
  108. FAM = o.fam o.interp o.io o.store o.system o._dumpcode o._debug o._version
  109.  
  110. # ARCHY
  111. # If I lack a working sed the above would be replaced with
  112. # FAM = o.fam o.interp o.io o.store o.system o.dumpcode o.debug o.version
  113. #  c.dumpcode c.debug and c.version would have to be created by
  114. # appropriate hand-editing of the h. files of the same name OR
  115. # (lazier but probably o.k.) copying the files in the hc directory.
  116.  
  117.  
  118. #
  119. #       How to build the ML interpreter.
  120. #
  121.  
  122. fam:    $(FAM)
  123.         $(CC) -o fam $(CFLAGS) $(LDFLAGS) $(FAM) $(LIBFLAGS)
  124.  
  125.  
  126. # ARCHY
  127. # The following sed wizardy probably won't work without a
  128. # little tweaking.
  129.  
  130. o._version: c._version
  131.         $(CC) -c $(CFLAGS) c._version
  132.         delete  c._version
  133.  
  134. c._version: c.* h.*
  135.         egrep "\$$Header" c.* h.* > _1
  136.         sed "s/.*\/\([^\/]*\),v \([^ \t]*\).*/\"\1 \2\",/" < _1 > _2
  137.         uecho "char VersionId[][80]" $(EQ) "{" > c._version
  138.         print _2 { >> c._version }
  139.         uecho "\"@(\#)CFLAGS = $(CFLAGS)\","  >> c._version 
  140.         uecho "\"@(\#)LDFLAGS = $(LDFLAGS)\","  >> c._version 
  141.         uecho "\"\"" } ;  >> c._version 
  142.         delete _1 _2
  143.  
  144.  
  145. #
  146. #       Create the routine which will print a profile of the FAM
  147. #       opcodes.  Note that this routine is built automatically from
  148. #       the master list of opcodes.
  149. #
  150. o._debug: c._debug
  151.         $(CC) -c $(CFLAGS) c._debug
  152.  
  153. c._debug: h.debug
  154.         sed -e "s/extern//" -e "s/\/\*\///g" < h.debug > c._debug
  155.  
  156. o._dumpcode:    c._dumpcode
  157.         $(CC) -c $(CFLAGS) c._dumpcode
  158.  
  159. c._dumpcode:    END.dumpcode h.bcodes
  160.         uecho "\#ifdef DEBUGinterp" > c._dumpcode
  161.         uecho "char opstrings[][40] = {" >> c._dumpcode
  162.         sed -n "s/^\#[\t ]*define[\t ]*\(Op[^\t ]*\)[\t ]*\(.*\)/\"\1\",/p" < h.bcodes >> c._dumpcode
  163.         uecho "\"INVALID_OPCODE\"} ;"  >> c._dumpcode 
  164.         uecho "int opcode[] = {" >> c._dumpcode
  165.         sed -n "s/^\#[\t ]*define[\t ]*\(Op[^\t ]*\)[\t ]*\(.*\)/\2,/p" < h.bcodes >> c._dumpcode
  166.         uecho "-1 } ;" >> c._dumpcode
  167.         print END.dumpcode { >> c._dumpcode }
  168.  
  169.